<html>
<head>
	<meta charset='utf-8' />
	<title>小区信息助手后台</title>
	<meta name="viewport" content="width=device-width,initial-scale=1.0,maximum-scale=1.0,user-scalable=0" />
	<style>
		@media screen and (max-width:450px){
			#content,.nav_div{width:98%;margin:0 auto}
			/*页面宽度900以下时 .abc的宽度为450*/
		}
		@media screen and (min-width:450px){
			#content,.nav_div{width:450px;margin:0 auto}
			/*页面宽度900以下时 .abc的宽度为450*/
		}
	</style>
</head>
<body>
<div id='content' style='position:relative;border:0px solid'>
	<h1 style='text-align:center'>修改密码</h1>
	
	<div style='text-align:center'>
		原　密　码：<input type="password" id='pwd1' />
	</div>
	<div style='text-align:center;margin:20px 0'>
		新　密　码：<input type="password"  id='pwd2' />
	</div>
	<div style='text-align:center'>
		确认新密码：<input type="password"  id='pwd3' />
	</div>
	
	<div style='text-align:center;margin:20px 0'>
		<button id='submit'>提交</button>
		<button onclick='history.go(-1)'>返回</button>
	</div>

</div>



</body>
</html>
<script src='../public/jquery.js'></script>
<script src='../public/fun.js'></script>
<script>
$(function(){
	//底部导航与显示页面
	$.ajax({
		url:'after_template_bottom_nav.html',
		success(res){
			$('body').append(res);
		}
	});


	//更改管理员密码
	$('#submit').click(function(){
		var p1 = $('#pwd1').val().trim();
		var p2 = $('#pwd2').val().trim();
		var p3 = $('#pwd3').val().trim();
		if(!p1 || !p2 || !p3){
			return;
		}
		if(p1 == p2){
			A('新旧密码不能相同！');return;
		}
		if(p2 != p3){
			A('两个新密码不一致！');return;
		}
		var data = {
			type:'UpdateAdminUserPwd',
			p1:p1,
			p2:p2
		}
		AjaxAfter(data,function(res){
			C(res);
			if(!/^{.*}$/.test(res)){
				return;
			}
			var tmp = JSON.parse(res);
			sessionStorage.admin_token1 = tmp.token1;
			if(tmp.stat == 'ok'){
				A('操作成功！');
				$('#pwd1,#pwd2,#pwd3').val('');
			}else{
				A('操作异常！');
			}
		});

	});
});
</script>